#include "pch.h"
#include "GRiObj.h"

void GRiObj::AddComponent(GUPtr<GRiComponent> comp)
{
	comp->mObj = this;
	mComponents[std::type_index(typeid(*(comp.get())))] = std::move(comp);
}

void GRiObj::AddComponent(GUSPtr<GRiComponent> comp)
{
	comp->mObj = this;
	mComponents[std::type_index(typeid(*(comp)))].reset(comp);
}

GRiBounds3Box GRiObj::GetBoundingBox() 
{
	auto box = GetComponent<GRiCmpGeometry>()->GetMesh()->Box;
	box = box.Transform(GetComponent<GRiCmpTransform>()->GetWorldMat());
	return box;
}
